#ifndef _SEQUENCE_INCLUDED
#define _SEQUENCE_INCLUDED

#include <windows.h>
#include "hexbaset.h"

class sequence
{
public:
	sequence() : hMemMap(0), filebuffer(0), adjustedptr(0), filebufferlength(0) {}

	BOOL init(char *filename);
	BOOL close();

	BOOL render(BYTE *buffer, size_w offset, size_w length);
	
	size_w size();

private:
	
	BYTE *get_adjusted_ptr(size_w offset);
	
	//
	//	Private data
	//
	HANDLE hMemMap;		//memory mapped object
	HANDLE hFile;		//handle to current file

	size_w length;		//logical size of this sequence

	
	size_w filebufferlength;	//size in bytes of the entire file

	BYTE *filebuffer;	//base of the view of the file
	
	

	BYTE *adjustedptr;	//an adjusted version of the filebuffer pointer


	size_w mappedoffset;	//offset of the current view within the memmap object
	size_w mappedlength;	//length of the view
};

#endif